create table jms_dm.dm_terminal_station_brand_sum_dt
(
    final_sign_network_code         varchar(100) COMMENT '末端网点code',
    end_agent_code                  varchar(100) COMMENT '末端代理区code',
    end_franchisee_code             varchar(100) COMMENT '末端加盟商code',
    final_plan_sign_date            date COMMENT '规划签收日期',
    end_agent_name                  varchar(100) COMMENT '末端代理区',
    end_franchisee_name             varchar(100) COMMENT '末端加盟商',
    final_sign_network_name         varchar(100) COMMENT '末端网点',
    terminal_source                 varchar(100) COMMENT '对接终端来源',
    need_sign_cnt                   bigint COMMENT '总单量',
    deliver_1_cnt                   bigint COMMENT '一派总量',
    deliver_2_cnt                   bigint COMMENT '二派总量',
    aging_sign_22_count             bigint COMMENT '时效签收22点前签收汇总',
    deliver_one_aging_sign_22_count bigint COMMENT '时效签收22点前签收汇总',
    deliver_two_aging_sign_22_count bigint COMMENT '时效签收22点前签收汇总',
    collect_in_cnt                  bigint COMMENT '入库量',
    collect_out_cnt                 bigint COMMENT '出库量',
    unfinished_count                bigint COMMENT '未完结量',
    date_time                       date COMMENT '业务日期',
    is_township int(6) comment '是否乡镇 1 是乡镇 0非乡镇'
)
    ENGINE = OLAP DUPLICATE KEY(final_sign_network_code,end_agent_code,end_franchisee_code)
comment '末端驿站汇总表'
PARTITION BY RANGE (date_time) (
   START ("2023-08-04") END ("2023-08-20") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(final_sign_network_code) BUCKETS 2
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-180",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "2",
"in_memory" = "false",
"storage_format" = "V2"
);

alter table jms_dm.dm_terminal_station_brand_sum_dt add column (
    actual_sign_22_count int comment'实际签收22前点签收量'
    );